import Mock from "mockjs";

const { data } = Mock.mock({
  // 20条数据
  "data|50": [
    {
      // 商品Id
      "goodsId|+1": 1,
      // 评价内容
      "goodsContent|1": [
        "好鞋，我喜欢，星星就随便打咯",
        "爱了爱了，星星就随便打咯",
        "保真，支持，星星就随便打咯",
      ],
      // 商品质量评分★
      "goodsStar|1-5": "★",
      // 服务态度评分★
      "serveStar|1-5": "★",
      // 物流评分★
      "mailStar|1-5": "★",
      // 商品信息
      "goodsName|1": [
        "乔丹Jordan",
        "耐克NIKE",
        "阿迪达斯Adidas",
        "AJ低帮藤原浩闪电",
        "DUNK SB黑白熊猫",
        "OW联名鞋",
      ],
      // 订单编号
      "goodsNum|1000000000000-9999999999999": 100000000000,
      // 买家信息
      "buyName|1": [
        "漩涡鸣人",
        "蒙奇D路飞",
        "黑崎一护",
        "纳兹",
        "泽田纲吉",
        "真新镇的小智",
        "八神太一",
      ],
    },
  ],
});

interface ParamsType {
  page: number;
  size: number;
}
class ProductServe {
  getData({ page, size }: ParamsType) {
    return new Promise((resolve) => {
      const result = data.slice((page - 1) * size, page * size);
      resolve({
        status: 0,
        result: result,
        count: data.length,
      });
    });
  }
}

const evaluate = new ProductServe();
export default evaluate;
